<?xml version="1.0" encoding="UTF-8"?>
<SWImpMsg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <SWImpHead>
        <CopMsgId>${declaration.businessId}_${declaration.id}</CopMsgId>
        <MsgType>SWDEC001</MsgType>
        <FunctionCode>G</FunctionCode>
        <Format>xml</Format>
        <Compress>0</Compress>
        <Version>1.0</Version>
    </SWImpHead>
    <SWImpData>
        <DecMessage>
            <DecHead>
                <SeqNo>${declaration.invNo?if_exists}</SeqNo>
                <IEFlag>${declaration.declarationType?if_exists}</IEFlag>
                <Type/>
                <AgentCode>${declaration.shenbaoCompanyCo?if_exists}</AgentCode>
                <AgentName>${declaration.shenbaoCompanyName?if_exists}</AgentName>
                <ApprNo/>
                <BillNo>${declaration.blNo?if_exists}</BillNo>
                <ContrNo><![CDATA[${declaration.contractNo?if_exists}]]></ContrNo>
                <CustomMaster>${declaration.declarationPortCode?if_exists}</CustomMaster>
                <CutMode>${declaration.levymodeCode?if_exists}</CutMode>
                <DistinatePort>${declaration.arrivedPortCode?if_exists}</DistinatePort>
                <DistrictCode>${declaration.goodsAddrCode?if_exists}</DistrictCode>
                <FeeCurr>${declaration.freight3?if_exists}</FeeCurr>
                <FeeMark>${declaration.freight1?if_exists}</FeeMark>
                <FeeRate>${declaration.freight2?if_exists}</FeeRate>
                <GrossWet>${declaration.grossWeight?if_exists}</GrossWet>
                <IEDate/>
                <IEPort>${declaration.exportPortCode?if_exists}</IEPort>
                <InRatio/>
                <InsurCurr>${declaration.premium3?if_exists}</InsurCurr>
                <InsurMark>${declaration.premium1?if_exists}</InsurMark>
                <InsurRate>${declaration.premium2?if_exists}</InsurRate>
                <LicenseNo>${declaration.licenseNo?if_exists}</LicenseNo>
                <ManualNo>${declaration.recordId?if_exists}</ManualNo>
                <NetWt>${declaration.netWeight?if_exists}</NetWt>
                <NoteS><![CDATA[${declaration.remark?if_exists}]]></NoteS>
                <OtherCurr>${declaration.otherfee3?if_exists}</OtherCurr>
                <OtherMark>${declaration.otherfee1?if_exists}</OtherMark>
                <OtherRate>${declaration.otherfee2?if_exists}</OtherRate>
                <OwnerCode>${declaration.fahuoCompanyCo?if_exists}</OwnerCode>
                <OwnerName>${declaration.fahuoCompanyName?if_exists}</OwnerName>
                <PackNo>${declaration.goodsCount?if_exists}</PackNo>
                <PayWay></PayWay>
                <PaymentMark>${declaration.texCompany?if_exists}</PaymentMark>
                <TradeCode>${declaration.companyCo?if_exists}</TradeCode>
                <TradeCountry>${declaration.arrivedCountryCode?if_exists}</TradeCountry>
                <TradeMode>${declaration.tradeModeCode?if_exists}</TradeMode>
                <TradeName>${declaration.companyName?if_exists}</TradeName>
                <TrafMode>${declaration.transportModeCode?if_exists}</TrafMode>
                <TrafName>${declaration.transportNa?if_exists}</TrafName>
                <TransMode>${declaration.dealMode?if_exists}</TransMode>
                <WrapType>${declaration.goodsPackageCode?if_exists}</WrapType>
                <EntryId>${declaration.declareCustomsCode?if_exists}</EntryId>
                <PreEntryId/>
                <EdiId>1</EdiId>
                <Risk/>
                <CopName>${declaration.shenbaoCompanyName?if_exists}</CopName>
                <CopCode>${declaration.shenbaoCompanyCo?if_exists}</CopCode>
                <EntryType>${declaration.customsTypeCode?if_exists}</EntryType>
                <PDate/>
                <TypistNo/>
                <InputerName/>
                <PartenerID/>
                <TgdNo/>
                <DataSource/>
                <DeclTrnRel>${declaration.dataType?if_exists}</DeclTrnRel>
                <ChkSurety/>
                <BillType/>
                <AgentCodeScc>${declaration.shenbaoCompanyCoUnite?if_exists}</AgentCodeScc>
                <OwnerCodeScc>${declaration.fahuoCompanyCoUnite?if_exists}</OwnerCodeScc>
                <TradeCodeScc>${declaration.companyCoUnite?if_exists}</TradeCodeScc>
                <CopCodeScc></CopCodeScc>
                <PromiseItmes>${declaration.specialRelationshipConfirm!"9"}${declaration.priceImpactConfirm!"9"}${declaration.paymentRoyaltilsConfirm!"9"}</PromiseItmes>
                <TradeAreaCode>${declaration.tradingCountryCode!"142"}</TradeAreaCode>
                <CheckFlow/>
            </DecHead>
        <#if declaration.commodityList??>
            <DecLists>
                <#list declaration.commodityList as dec>
                    <DecList>
                        <ClassMark/>
                        <CodeTS>${dec.codeT?if_exists + dec.codeS?if_exists}</CodeTS>
                        <ContrItem><#if declaration.declarationType == "E">${dec.record_id?if_exists}<#elseif declaration.declarationType == "I">${dec.contractNumber?if_exists}</#if></ContrItem>
                        <DeclPrice>${dec.unitPrice?if_exists}</DeclPrice>
                        <DutyMode>${dec.levymodeCode?if_exists}</DutyMode>
                        <Factor/>
                        <GModel><![CDATA[${dec.goodsMode?if_exists}]]></GModel>
                        <GName>${dec.name?if_exists}</GName>
                        <GNo>${dec.indexNum!dec_index+1}</GNo>
                        <OriginCountry><#if declaration.declarationType == "I">${dec.originCountryCode?if_exists}<#elseif declaration.declarationType == "E">${dec.destinationCode?if_exists}</#if></OriginCountry>
                        <TradeCurr>${dec.currencyCode?if_exists}</TradeCurr>
                        <DeclTotal>${dec.totalPrice?if_exists}</DeclTotal>
                        <GQty>${dec.count?if_exists}</GQty>
                        <FirstQty>${dec.legalCount?if_exists}</FirstQty>
                        <SecondQty>${dec.secondCount?if_exists}</SecondQty>
                        <GUnit>${dec.unitCode?if_exists}</GUnit>
                        <FirstUnit>${dec.legalUnitCode?if_exists}</FirstUnit>
                        <SecondUnit>${dec.secondUnitCode?if_exists}</SecondUnit>
                        <UseTo>${dec.producer?if_exists}</UseTo>
                        <WorkUsd>${dec.processingFee?if_exists}</WorkUsd>
                        <ExgNo>${dec.goodsNo?if_exists}</ExgNo>
                        <ExgVersion/>
                        <DestinationCountry><#if declaration.declarationType == "E">${dec.originCountryCode?if_exists}<#elseif declaration.declarationType == "I">${dec.destinationCode?if_exists}</#if></DestinationCountry>
                    </DecList>
                </#list>
            </DecLists>
        </#if>
            <DecFreeTxt>
                <RelId>${declaration.reManifest?if_exists}</RelId>
                <RelManNo>${declaration.reRecordId?if_exists}</RelManNo>
                <BonNo>${declaration.reJianguan?if_exists}</BonNo>
                <VoyNo>${declaration.voyageNo?if_exists}</VoyNo>
                <DecBpNo/>
                <CusFie>${declaration.reYardId?if_exists}</CusFie>
                <DecNo/>
            </DecFreeTxt>
            <DecSign>
                <CopCode>${declaration.shenbaoCompanyCo?if_exists}</CopCode>
                <ClientSeqNo>${declaration.businessId}</ClientSeqNo>
                <SignDate>${.now?string("yyyyMMddHHmmssSSS")}</SignDate>
                <OperType>G</OperType>
            </DecSign>
            <DecContainers>
            <#list declaration.containerList as container>
                <Container>
                    <ContainerId>${container.containerNo?if_exists}</ContainerId>
                    <ContainerMd>${container.containerStandard?if_exists}</ContainerMd>
                    <ContainerWt><#if container.containerWeight?exists>${container.containerWeight?string('#')}</#if></ContainerWt>
                </Container>
            </#list>
            </DecContainers>
        <#if declaration.licenseDocuList??>
            <DecLicenseDocus>
                <#list declaration.licenseDocuList as licenseDocu>
                    <LicenseDocu>
                        <DocuCode>${licenseDocu.suifudanCo?if_exists}</DocuCode>
                        <CertCode><![CDATA[${licenseDocu.suifudanNo?if_exists}]]></CertCode>
                    </LicenseDocu>
                </#list>
            </DecLicenseDocus>
        </#if>
        <#if declaration.dataType == "1">
            <TrnHead>
                <TrnPreId></TrnPreId>
                <TransNo><#if declaration.transportNa?exists>${declaration.transportNa?replace("@","")}</#if></TransNo>
                <TurnNo></TurnNo>
                <NativeTrafMode></NativeTrafMode>
                <TrafCustomsNo></TrafCustomsNo>
                <NativeShipName></NativeShipName>
                <NativeVoyageNo>${declaration.voyageNo?if_exists}</NativeVoyageNo>
                <ContractorName></ContractorName>
                <ContractorCode></ContractorCode>
                <TransFlag>1</TransFlag>
                <ValidTime><#if declaration.confirmTime?exists>${declaration.confirmTime?if_exists?string("yyyyMMdd")}</#if></ValidTime>
                <ESealFlag>N</ESealFlag>
                <Notes/>
                <TrnType>0</TrnType>
                <ApplCodeScc></ApplCodeScc>
            </TrnHead>
            <TrnList>
                <TrafMode>${declaration.transportModeCode?if_exists}</TrafMode>
                <ShipId></ShipId>
                <ShipNameEn/>
                <VoyageNo/>
                <BillNo>${declaration.blNo?if_exists}</BillNo>
                <IEDate><#if declaration.exportDate?exists>${declaration.exportDate?if_exists?string("yyyyMMdd")}</#if></IEDate>
            </TrnList>
            <#if declaration.containerList??>
                <TrnContainers>
                    <#list declaration.containerList as container>
                        <TrnContainer>
                            <ContaNo>${container.containerNo?if_exists}</ContaNo>
                            <ContaSn>${container_index+1}</ContaSn>
                            <ContaModel>${container.containerStandard?if_exists}</ContaModel>
                            <SealNo></SealNo>
                            <TransName><#if declaration.shipCode?exists && declaration.shipName?exists>${declaration.shipCode + "/" + declaration.shipName}</#if></TransName>
                            <TransWeight><#if container.containerWeight?exists>${container.containerWeight?string('#')}</#if></TransWeight>
                        </TrnContainer>
                    </#list>
                </TrnContainers>
            </#if>
        </#if>
        </DecMessage>
    </SWImpData>
</SWImpMsg>